package upload

import (
	"go-web-scaffold/api"
	"go-web-scaffold/tws"

	"net/http"

	"github.com/gin-gonic/gin"
)

func FileUploadController(engine *gin.Engine, routerManager *tws.RouterManager, instance *api.SqliteDB) {
	uploadFile(engine)
}

func uploadFile(engine *gin.Engine) {
	api.FileUploader("/fileupload", "./files", func(result *api.UploadResult, ctx *gin.Context) {
		ctx.JSON(http.StatusOK, gin.H{
			"Message": result.Message,
			"Name":    result.Name,
			"Size":    result.Size,
		})
	}, engine)
}
